//
//  AdminPasswordViewController.m
//  RONGAO
//
//  Created by Kendama on 2018/2/26.
//  Copyright © 2018年 wei wang. All rights reserved.
//

#import "AdminPasswordViewController.h"
#import "LineTextFieldView.h"

@interface AdminPasswordViewController ()

@property(nonatomic,strong)LineTextFieldView *oldPasswordTF;
@property(nonatomic,strong)LineTextFieldView *passwordTF;
@property(nonatomic,strong)LineTextFieldView *verifyPasswordTF;
@property(nonatomic,strong) UIButton *saveButton;

@end

@implementation AdminPasswordViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

#pragma mark - --------------------------点击事件--------------------------
- (void)didClickSaveButton
{
    
}

#pragma mark - --------------------------懒加载--------------------------
- (LineTextFieldView *)oldPasswordTF
{
    if(!_oldPasswordTF)
    {
        UIView *superView = self.view;
        _oldPasswordTF = [[LineTextFieldView alloc]init];
        [superView addSubview:_oldPasswordTF];
        _oldPasswordTF.textField.font = [UIFont systemFontOfSize:14];
        _oldPasswordTF.textField.placeholder = @"请输入原密码";
    }
    return _oldPasswordTF;
}

- (LineTextFieldView *)passwordTF
{
    if(!_passwordTF)
    {
        UIView *superView = self.view;
        _passwordTF = [[LineTextFieldView alloc]init];
        [superView addSubview:_passwordTF];
        _passwordTF.textField.font = [UIFont systemFontOfSize:14];
        _passwordTF.textField.placeholder = @"请输入新密码";
    }
    return _passwordTF;
}

- (LineTextFieldView *)verifyPasswordTF
{
    if(!_verifyPasswordTF)
    {
        UIView *superView = self.view;
        _verifyPasswordTF = [[LineTextFieldView alloc]init];
        [superView addSubview:_verifyPasswordTF];
        _verifyPasswordTF.textField.font = [UIFont systemFontOfSize:14];
        _verifyPasswordTF.textField.placeholder = @"请确认新密码";
    }
    return _verifyPasswordTF;
}

- (UIButton *)saveButton
{
    if(!_saveButton)
    {
        UIView *superView = self.view;
        _saveButton = [[UIButton alloc]init];
        [superView addSubview:_saveButton];
        [_saveButton setTitle:@"确认修改" forState:UIControlStateNormal];
        [_saveButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [_saveButton.titleLabel setFont:[UIFont systemFontOfSize:14]];
        [_saveButton setBackgroundImage:[UIImage imageNamed:@"button_next_nor"] forState:UIControlStateNormal];
        [_saveButton addTarget:self action:@selector(didClickSaveButton) forControlEvents:UIControlEventTouchUpInside];
    }
    return _saveButton;
}

#pragma mark - --------------------------约束--------------------------
- (void)masLayoutSubview{
    
    __weak UIView *superView = self.view;
    [self.oldPasswordTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.mas_equalTo(superView);
        make.height.mas_equalTo(58);
    }];
    
    [self.passwordTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_oldPasswordTF.mas_bottom);
        make.left.right.mas_equalTo(superView);
        make.height.mas_equalTo(58);
    }];

    [self.verifyPasswordTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_passwordTF.mas_bottom);
        make.left.right.mas_equalTo(superView);
        make.height.mas_equalTo(58);
    }];
    
    [self.saveButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_verifyPasswordTF.mas_bottom).with.offset(58);
        make.centerX.mas_equalTo(superView.mas_centerX);
        make.left.mas_equalTo(superView.mas_left).with.offset(pxScaleWidth(65));
        make.right.mas_equalTo(superView.mas_left).with.offset(pxScaleWidth(-65));
    }];
    
}


#pragma mark - --------------------------导航栏--------------------------
- (void)setNavigationStyle
{
    [self setLeftButtonImage:[UIImage imageNamed:@"icon_back_nor"]];
    [self setNavigationTitle:@"修改密码" titleColor:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
